<script language="javascript">
	function UpdateCart()
{
	document.updatecartForm.submit();
}
</script>
<form name="updatecartForm" method="POST" action="{if $order == 0}/cart/update{else}/cart/view/order/submit{/if}" enctype="multipart/form-data">
	<input type="hidden" name="kind" value="">
	<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
		<tr>
			<td class="bgtitle">
				<table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
					<tr>
						<td width="20"><img src="/templates/images/mui_ten.gif" /></td>
						<td valign="bottom" class="title">Giỏ hàng</td>
						<td width="10" valign="bottom">&nbsp;</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td valign="top" ><img src="../templates/images/space.gif" width="1" height="10" /></td>
		</tr>
	</table>
	<br />
	{if isset($count) && $count != 0}
		{if $order == 1}
			<table width="98%" border="0" cellspacing="0" cellpadding="2" align="center">
				<tbody>
					<tr>
						<td width="50%">
							<strong>Mã đơn hàng: 
								<input type="hidden" value="{$order_code}" name="order_code" id="order_code">
								<font color="#FF0000">{$order_code}</font>
							</strong>
						</td>
						<td>
							<strong>Ngày đặt hàng:</strong> 
							<font color="#FF0000">
							<input type="hidden" value="{$order_date}" name="order_date" id="order_date">
							<strong>{$order_date}</strong>
							</font>
						</td>
					</tr>
				</tbody>
			</table>
			<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
				<tbody>
					<tr>
						<td valign="top" width="50%">
							<table width="100%" border="0" cellspacing="0" cellpadding="2" align="center">
								<tbody>
									<tr>
										<td height="30">
											<strong>Thông tin đặt hàng:</strong>
										</td>
									</tr>
									<tr>
										<td>
											<table width="100%" border="0" cellspacing="0" cellpadding="2" align="center">
												<tbody>
													<tr>
														<td width="25%" valign="top">Tên đầy đủ:&nbsp;</td>
														<td valign="top">{$user_information[0].fullname}</td>
													</tr>
													<tr>
														<td valign="top">Điện thoại:&nbsp;</td>
														<td valign="top">{$user_information[0].phone}</td>
													</tr>
													<tr>
														<td valign="top">Địa chỉ email:&nbsp;&nbsp;</td>
														<td valign="top">{$user_information[0].email}</td>
													</tr>
													<tr>
														<td valign="top">Địa chỉ:&nbsp;&nbsp;</td>
														<td valign="top">{$user_information[0].address}<!--, $order_state --></td>
													</tr>
												</tbody>
											</table>
										</td>
									</tr>
								</tbody>
							</table>
						</td>
						<td valign="top">
							<table width="100%" border="0" cellspacing="0" cellpadding="2" align="center">
								<tbody>
									<tr>
										<td height="30">
											<strong>Thông tin giao hàng:</strong>
										</td>
									</tr>
									<tr>
										<td>
											<table width="100%" border="0" cellspacing="0" cellpadding="2" align="center">
												<tbody>
													<tr>
														<td width="25%" valign="top">Tên đầy đủ:&nbsp;</td>
														<td><input name="order_name" type="hidden" id="order_name" value="{$order_name}" />
															{$order_name}
														</td>
													</tr>
													<tr>
														<td valign="top">Điện thoại:&nbsp;</td>
														<td>
															<input name="order_phone" type="hidden" id="order_phone" value="{$order_phone}" />
															{$order_phone}
														</td>
													</tr>
													<tr>
														<td valign="top">Địa chỉ email:&nbsp;&nbsp;</td>
														<td>
															<input name="order_email" type="hidden" id="order_email" value="{$order_email}" />
															{$order_email}
														</td>
													</tr>
													<tr>
														<td valign="top">Địa chỉ nhận:&nbsp;&nbsp;</td>
														<td>
															<input name="order_address" type="hidden" id="order_address" value="{$order_address}" />
															{$order_address}
														</td>
													</tr>
												</tbody>
											</table>
										</td>
									</tr>
								</tbody>
							</table>
						</td>
					</tr>
				</tbody>
			</table>
			<table width="98%" border="0" cellspacing="0" cellpadding="2" align="center">
				<tbody>
					<tr>
						<td height="30">
							<strong>Phương thức thanh toán: </strong>
							<font color="#FF0000">
							{if $phuongthucthanhtoan == 1}
								<strong>Thanh toán tiền mặt khi giao hàng tận nơi</strong>
							{else}
								<strong>Thanh toán chuyển khoản NganLuong</strong>
							{/if}
							<input type="hidden" value="{$phuongthucthanhtoan}" name="phuongthucthanhtoan" id="phuongthucthanhtoan">
							</font>
						</td>
					</tr>
					<tr>
						<td>
							<strong> Yêu cầu khác: </strong>
							<input name="order_note" type="hidden" id="order_note" value="{$order_note}" />
							{$order_note}
						</td>
					</tr>
				</tbody>
			</table>
			<br>
		{/if}
		<table width='98%' align='center' border='0' cellpadding='2' cellspacing='0' bordercolor='#CCCCCC' style='border-collapse:collapse'>
			<tr>
				<td class='bgmenupro border3' height='30' bgcolor='#DDDDDD' width='5%'>
					<div align='center'>
						<strong>STT</strong>
					</div>
				</td>
				<td class='bgmenupro border3' bgcolor='#DDDDDD' width='10%'>
					<div align='center'>
						<strong>Hình ảnh</strong>
					</div>
				</td><td class='bgmenupro border3' bgcolor='#DDDDDD'>
					<div align='center'>
						<strong>Tên sản phẩm</strong>
					</div>
				</td>
				<td class='bgmenupro border3' bgcolor='#DDDDDD' width='18%'>
					<div align='center'>
						<strong>Giá tiền</strong>
					</div>
				</td>
				<td class='bgmenupro border3' bgcolor='#DDDDDD' width='10%'>
					<div align='center'>
						<strong>Số lượng</strong>
					</div>
				</td>
				<td class='bgmenupro {if $order == 0}border3 {else} borderfull {/if}' bgcolor='#DDDDDD' width='18%'>
					<div align='center'>
						<strong>Thành tiền</strong>
					</div>
				</td>
				{if $order == 0}
					<td class='bgmenupro borderfull' bgcolor='#DDDDDD' width='5%'>
						<div align='center'>
							<strong>Xóa</strong>
						</div>
					</td>
				{/if}
			</tr>
			<!-- sản phẩm mua -->
			{foreach from=$cart item=cart_item}
				<tr>
					<td class='fontsizecart border3'>
						<div align='center'>{$cart_item@index+1}</div>
					</td>
					<td class='border3' >
						<div align='center'>
							<a href='/productdetail/{$cart_item.idproduct}'>
								<img src='/templates/images/product/{$cart_item.image}' width='60' border='0'>
							</a>
						</div>
					</td>
					<td class='fontsizecart border3'>
						<div align='center'>
							<a href='/productdetail/{$cart_item.idproduct}' class='linkcart'>{$cart_item.productname}</a>
						</div>
					</td>
					<td class='cartprice fontsizecart border3'>{($cart_item.price*(1-$promotion_start*$promotionbytime.percentdiscount/100))|number_format} VNĐ</td>
					<td class='border3'>
						<div align='center'>
							{if $order == 0}
								<input type='text' maxlength="1" size="2" name='quantity[{$cart_item.idproduct}]' value='{$cart_item.quantity}' class='box_input_2' style='text-align:center;' onKeyPress="return keypress(event);" >
							{else}
								{$cart_item.quantity}
							{/if}
						</div>
					</td>
					<td class='{if $order == 0}cartprice fontsizecart border3{else}borderfull{/if}' style="text-align: center">
						<strong>{($cart_item.price*(1-$promotion_start*$promotionbytime.percentdiscount/100)*$cart_item.quantity)|number_format} VNĐ</strong>
					</td>
					{if $order == 0}
						<td class='borderfull' >
							<div align='center'>
								<a href='/cart/delete/{$cart_item.idproduct}'>
									<img src='/templates/images/delete.gif' border='0'>
								</a>
							</div>
						</td>
					{/if}
				</tr>
			{/foreach}
			<!-- // sản phẩm mua -->
			<tr>
				<td colspan='5' class='cartprice fontred fontsizecart border3' >
					<strong>Tổng giá trị</strong>
				</td>
				<td class='cartprice fontred fontsizecart {if $order == 0}border3{else}borderfull{/if}' >{$total|number_format} VNĐ</td>
			<input type="hidden" value="{$total}" name="order_total" id="order_total">
			{if $order == 0}
				<td class='borderfull' >&nbsp;</td>
			{/if}
			</tr>
		</table>
		<br>
		{if $order == 0}
			<table align='center' cellpadding='2' cellspacing='0'>
				<tr>
					<td>
						<a href='/product/camera'>
							<img src='/templates/images/btn_continue.gif' border='0' style='cursor: pointer' ></a>
					</td> 
					<td>
						<a href='/cart/delete/0'>
							<img src='/templates/images/btn_emty.gif' border='0' style='cursor: pointer' >
						</a>
					</td>
					<td>
						<img src='/templates/images/btn_update.gif' onclick="UpdateCart()" style='cursor: pointer'>
					</td>
				</tr>
			</table>
		{else}
			<table border="0" align="center" cellpadding="5" cellspacing="0">
				<tbody>
					<tr>
						<td>
							{if $phuongthucthanhtoan == 1}
								<input type="image" src="/templates/images/btn_pay.gif" name="order_pay" onclick="return gotoSubmit()">
							{else}
								<a target="_blank" href="https://www.nganluong.vn/button_payment.php?receiver=tranquocminh1112@gmail.com&product_name={$order_code}&price={$total/1000}&return_url=http://tranquocminh1112.no-ip.info/cart/view/order/submit&comments=Thanh toán đơn hàng của {$order_name}." >
									<img src="https://www.nganluong.vn/data/images/buttons/3.gif"  border="0" />
								</a> 
							{/if}
						</td>
					</tr>
				</tbody>
			</table>
		{/if}
	{else}
		<div align="center">Quý khách vui lòng chọn <a href="/product/camera"><u>sản phẩm</u></a> để mua.</div>
	{/if}
</form>
<br />
{if isset($count) && $count != 0 && $order == 0 }
	<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
		<tr>
			<td>
				<style type="text/css">
					.dropcontent{
						width: 350px;
						height: auto;
						padding-top:0px;
						padding-bottom:0px;
						padding-left:0px;
						padding-right:0px;
						display:block;
					}
				</style>
				<script type="text/javascript">

				/*
				Combo-Box Viewer script- Created by and © Dynamicdrive.com
				Visit http://www.dynamicdrive.com/ for this script and more
				This notice MUST stay intact for legal use
				 */

				/*if (document.getElementById){
				document.write('<style type="text/css">\n')
				có 1 dòng 
				document.write('</style>\n')
				}
				 */
				function contractall(){
				if (document.getElementById){
				var inc=0
				while (document.getElementById("dropmsg"+inc)){
				document.getElementById("dropmsg"+inc).style.display="none"
				inc++
			}
		}
	}

	function expandone(){
	if (document.getElementById){
	var selectedItem=document.viewcartForm.phuongthucthanhtoan.selectedIndex
	contractall()
	document.getElementById("dropmsg"+selectedItem).style.display="block"
}
}

if (window.addEventListener)
window.addEventListener("load", expandone, false)
else if (window.attachEvent)
window.attachEvent("onload", expandone)
				</script>
				<script language="javascript">
function gotoSubmit()
										{
					document.viewcartForm.kind.value = "1"
					with(document.viewcartForm)
												{

							if(order_name.value == ""){
							alert('Vui lòng nhập tên đầy đủ.')
							order_name.focus()
							return false
						}
						if(order_phone.value == ""){
						alert('Vui lòn nhập số điện thoại.')
						order_phone.focus()
						return false
					}
					if(order_address.value == ""){
					alert('Vui lòng nhập địa chỉ.')
					order_address.focus()
					return false
				}
				if(order_state.value == 0){
				alert('Vui long chọn tỉnh thành.')
				order_state.focus()
				return false
			}
			if(phuongthucthanhtoan.value == 0){
			alert('Vui lòng chọn phương thức thanh toán.')
			phuongthucthanhtoan.focus()
			return false
		}
		return true
	}
	//document.mainForm.submit()
}

function keypress(e){
//Hàm dùng để ngăn người dùng nhập các ký tự khác ký tự số vào TextBox
var keypressed = null;
if (window.event)
										{
keypressed = window.event.keyCode; //IE
}
else
										{ 
keypressed = e.which; //NON-IE, Standard
}

if (keypressed < 48 || keypressed > 51) //57
										{ //CharCode của 0 là 48 (Theo bảng mã ASCII)
//CharCode của 9 là 57 (Theo bảng mã ASCII)
if (keypressed == 8 || keypressed == 127)
												{
//Phím Delete và Phím Back
return;
}
alert("Vui lòng nhập số! Từ 0 đến 3!");
return false;
}
}
function data_change(field)
						{
var check = true;
var value = field.value; //get characters
//check that all characters are digits, ., -, or ""
for(var i=0;i < field.value.length; ++i)
								{
var new_key = value.charAt(i); //cycle through characters
if(((new_key < "0") || (new_key > "9")) && 
!(new_key == ""))
										{
check = false;
break;
}
}
//apply appropriate colour based on value
if(!check)
								{
field.style.backgroundColor = "red"
alert('Vui lòng nhập số.')
order_phone.focus()
return false
}
else
								{
field.style.backgroundColor = "white"
}
return true
}
				</script>

				<form name="viewcartForm" method="POST" action="/cart/view/order" enctype="multipart/form-data" onsubmit="return gotoSubmit()">
					<input type="hidden" name="kind" value="1">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td valign="top">&nbsp;</td>
						</tr>
						<tr>
							<td width="49%" valign="top">
								<table width="100%" border="0" cellspacing="0" cellpadding="0">
									<tr>
										<td width="49%" height="30" background="/templates/images/bgtop.jpg" bgcolor="#DDDDDD" class="bgmenupro" style="padding-left:10px; border-top:1px #CCCCCC solid; border-left:1px #CCCCCC solid; border-right:1px #CCCCCC solid;">
											<strong>Thông tin giao hàng</strong></td>
										<td width="2%" >&nbsp;</td>
										<td background="/templates/images/bgtop.jpg" bgcolor="#DDDDDD" class="bgmenupro" style="padding-left:10px; border-top:1px #CCCCCC solid; border-left:1px #CCCCCC solid; border-right:1px #CCCCCC solid;">
											<strong>Phương thức thanh toán</strong></td>
									</tr>
									<tr>
										<td valign="top" style="border:1px #CCCCCC solid; padding:10px; height:210px;">
											<table width="100%" border="0" cellpadding="3" cellspacing="0" bordercolor="#CCCCCC" style="font-family: Tahoma; font-size: 10pt; border-collapse:collapse; padding:10px">
												<tr >
													<td width="30%">Tên đầy đủ (*)</td>
													<td width="70%">
														<input name="order_name" type="text" maxlength="30" class="box_input" id="order_name" size="24"  value="{$user_information[0].fullname}" /></td>
												</tr>
												<tr bgcolor="">
													<td>Điện thoại (*)</td>
													<td>
														<input name="order_phone" type="text" maxlength="11"  class="box_input" id="order_phone" size="24"  value="{$user_information[0].phone}" onchange="return data_change(this)" /></td>
												</tr>
												<tr >
													<td>Địa chỉ email</td>
													<td>
														<input name="order_email" type="text" maxlength="30" id="order_email" value="{$user_information[0].email}" size="24" class="box_input" />

													</td>
												</tr>
												<tr bgcolor="">
													<td>Địa chỉ (*)</td>
													<td>
														<input name="order_address" type="text" maxlength="50" class="box_input" id="order_address" size="24"  value="{$user_information[0].address}" />
													</td>
												</tr>
												<!--
												<tr bgcolor="">
														<td valign="top">Tỉnh/Thành (*)</td>
														<td>
																<select name="order_state" id="order_state" class="box_input_2" >
																		<option value="0">- Vui lòng chọn -</option>
																		<option value=1 >TP.Hồ Chí Minh</option>
																		<option value=2 >TP.Hà Nội</option>
																		<option value=3 >TP.Huế</option>
																		<option value=4 >Đà Nẵng</option>
																		<option value=5 >Hải Phòng</option>
																</select>                  
														</td>
												</tr>
												-->
												<tr >
													<td valign="top">Yêu cầu khác</td>
													<td><textarea name="order_note" id="order_note" maxlength="100" cols="45" rows="5" class="box_input"></textarea></td>
												</tr>
											</table>
										</td>
										<td >&nbsp;</td>
										<!-- Phương thức thanh toán -->
										<td valign="top" style="border:1px #CCCCCC solid; padding:10px; height:210px;">
											<table width="100%" border="0" cellpadding="0" cellspacing="0">
												<tr bgcolor="">
													<td>
														<select name="phuongthucthanhtoan" id="orderphuongthucthanhtoan" class="box_input2" onchange="expandone()">
															<option value=1 selected>Thanh toán tiền mặt khi giao hàng tận nơi</option>
															<option value=2 >Thanh toán chuyển khoản qua ngân hàng hoặc máy ATM</option>
														</select>
													</td>
												</tr>
												<tr bgcolor="">
													<td>
														<div id='dropmsg0' class='dropcontent'>
															<p>Nhân viên của chúng tôi sẽ giao hàng đến tận nơi bạn yêu cầu (hiện tại phương thức này chỉ áp dụng tại TP.HCM)</p>
															<p style="text-align: center;">
																<img width="200" height="123" alt="" src="/templates/images/free_shipping.png" />
															</p>
														</div>
														<div id='dropmsg1' class='dropcontent'>
															<p style="text-align: left;">Quý khách đến ngân hàng Vietcombank hoặc các điểm đặt máy ATM gần nhất để chuyển khoản.</p>
															(Quý khách có hoặc không có tài khoản ngân hàng đều thực hiện được việc chuyển khoản, 
															vui lòng liên hệ qua số Hotline: 0906 90 11 12 trước và sau khi chuyển tiền)
															</p>
															<p style="text-align: center;">
																<img width="120" height="120" src="/templates/images/Bank.png" alt="" />
																<br />
																<strong>
																	Ngân hàng ngoại thương HCM (Vietcombank)<br>
																	Tên TK: Trần Quốc Minh - Số TK: 0511003860293
																</strong>
															</p>
														</div>
													</td>
												</tr>
											</table>
										</td>
									</tr>

								</table>
							</td>
						</tr>
					</table>
					<br>
					<table border="0" align="center" cellpadding="0" cellspacing="0">
						<tr>
							<td>
								<input type="image" src="/templates/images/btn_booknow.gif"  />

							</td>
						</tr>
					</table>
				</form>

			</td>
		</tr>
	</table>
	<script type="text/javascript">
var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only

/*if (document.getElementById){ //DynamicDrive.com change
	document.write('<style type="tdocumentext/css">\n')

	document.write('</style>\n')
	}
*/
function SwitchMenu(obj){
if(document.getElementById){
var el = document.getElementById(obj);
var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
if(el.style.display != "block"){ //DynamicDrive.com change
for (var i=0; i<ar.length; i++){
if (ar[i].className=="submenu") //DynamicDrive.com change
ar[i].style.display = "none";
}
el.style.display = "block";
}else{
el.style.display = "none";
}
}
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function onloadfunction(){
if (persistmenu=="yes"){
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=get_cookie(cookiename)
if (cookievalue!="")
document.getElementById(cookievalue).style.display="block"
}
}

function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}

if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction

if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate

	</script>
	<!-- end: swith menu !-->
	<script language="JavaScript1.1">
<!--

var whichlink=0
var whichimage=0
var blenddelay=(ie)? document.images.slide.filters[0].duration*1000 : 0
function slideit(){
if (!document.images) return
if (ie) document.images.slide.filters[0].apply()
document.images.slide.src=imageholder[whichimage].src
if (ie) document.images.slide.filters[0].play()
whichlink=whichimage
whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0
setTimeout("slideit()",slidespeed+blenddelay)
}
slideit()
//-->
	</script> 
{/if}